<?php
session_cache_expire(999999999);
if(!isset($_SESSION)) 
{ 
session_start(); 
} 
if(!isset($_SESSION['db'])){
	$addressbrowser = $_SERVER['SERVER_NAME'];
	$temp = explode(".", $addressbrowser);
	$connection = mysql_connect("1.234.53.52", "cam", "5678" ) ;
	//$connection = mysql_connect("localhost", "root", "root" ) ;
	mysql_select_db("elihan", $connection);
	mysql_query("set names 'utf8'");
	$selectdatabase = mysql_query("SELECT am.DatabaseName,am.Logo from ac_eli_manager am where am.KeyName='$temp[0]' and am.`Status` = 2");
	$result = mysql_fetch_assoc($selectdatabase);

	$_SESSION['Logo']=$result[Logo];
		
	$_SESSION['db']= $result[DatabaseName];
	mysql_close($connection);
}
$database = $_SESSION['db'];
$connectadmin = mysql_connect("1.234.53.52", "cam", "5678") or die("Không kết nối được database");
//$connectadmin = mysql_connect("localhost", "root", "root") or die("Không kết nối được database");
mysql_select_db("elihan", $connectadmin);
mysql_query("set names 'utf8'");

$selectprofilecomp = mysql_query("SELECT eli.PartnerName, eli.Address,eli.BusinessNumber, eli.CorporateNumber
		 FROM ac_eli_manager eli where eli.DatabaseName='$database'");



$row = mysql_fetch_array($selectprofilecomp);
mysql_close($connectadmin);
?>
<?php

include '../../operations/connection.php';

$idemppowers = $_REQUEST['idemppowers'];
$idempassigns = $_REQUEST['idempassigns'];
function getlang(){
		$lang = $_SESSION['lang'];
		
		if (empty($lang) || $lang == "EN") {
			$value = "../../value/value_en.php";
		} else if($lang == "VN") {
			$value = "../../value/value_vn.php";
		}
		else {
			$value = "../../value/value_kr.php";
		}
		return $value;
	}
	$value = getlang();
	include($value);

$selectpower = mysql_query("SELECT e.FullName, e.CMND FROM employee e where  e.IDEmployee = '$idemppowers'");
$selectassign = mysql_query("SELECT e.FullName, e.CMND,e.Address,e.Position FROM employee e where  e.IDEmployee = '$idempassigns'");

$resultpower = mysql_fetch_assoc($selectpower);
$resulrassign = mysql_fetch_assoc($selectassign);
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Print</title>
<style>
.print-credential {
	width: 800px;
	padding: 30px;
	border:2px solid #424242;
	font-size:17px;
}
.print-credential-caption{
	display: block;
	text-align: center;
	text-transform: uppercase;
	margin: 0 0 50px;
	font-size:22px;
	font-weight:bold;
}
</style>
</head>

<body onload="window.print();">
<div class="print-credential"  style="margin-left: 20%">
		<span class="print-credential-caption"><?php echo $l_powerattorny?></span> 
		<span><b><?php echo $l_company_name?></b> : <?php echo $row[PartnerName];?></span><br /> 
		<span><b><?php echo $l_address?></b> : <?php echo $row[Address];?></span><br />
		<span><b><?php echo $l_corponum?></b> :<?php echo $row[CorporateNumber];?></span><br /> 
		<span><b><?php echo $l_bussinum?></b> :<?php echo $row[BusinessNumber];?></span><br /> 
		<span><b><?php echo $l_itemattorny?></b> : </span><br />
		<span><b>1. <?php echo $l_principals?> : </b> <?php echo $resultpower[FullName]."( ".$l_cmnd." : ".$resultpower[CMND].")";?></span><br />
		<div style="margin: 150px 0px 0px 0px;">
			<b>2. <?php echo $l_assignee?> </b>
		</div>
		<span><b><?php echo $l_fullname?></b> : <?php echo $resulrassign[FullName];?></span><br /> 
		<span><b><?php echo $l_cmnd?></b> : <?php echo $resulrassign[CMND]?></span><br />
		<span><b><?php echo $l_address?></b> : <?php echo $resulrassign[Address]?></span><br /> 
		<span><b><?php echo $l_relationship?></b> : <?php echo $l_employee?></span><br />
		<div style="margin: 100px 0px 200px 0px;">
			<b>3. <?php echo $l_madateditem?></b>
		</div>
		<div id="date" style="text-align: right">
		<?php if ($lang=="EN"){$datetime = date('Y-m-d') ;echo $datetime;}
					else if($lang=="VN"){$day = date('d');$month = date('m');$year=date('Y');
						echo "Ngày ".$day." Tháng ".$month." Năm ".$year;}
					else if($lang=="KR"){$day = date('d');$month = date('m');$year=date('Y'); 
						echo $year." 년  ".$month." 월  ".$day." 일";}
				?>
		</div>
	</div>
</body>
</html>